import Vue from 'vue'
import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/assets/style/index.scss' // global css
import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import '@/assets/icon/iconfont.css' // global css
import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control
import XEUtils from 'xe-utils'
import VXETable from 'vxe-table'
import ueditorFrom from '@/components/ueditorFrom'
import VueUeditorWrap from 'vue-ueditor-wrap'
import UploadIndex from '@/components/uploadPicture/index.vue'
import iconFrom from './components/iconFrom'
import UploadFile from '@/components/Upload/uploadFile.vue'
import TimeSelect from '@/components/TimeSelect'
import 'vxe-table/lib/style.css'

import Directives from './commons/directives' // 公共指令
import formCreate from '@form-create/element-ui'
import FcDesigner from '@form-create/designer'
import i18n from '@/assets/lang' // internationalization
import DataV from '@jiaminghi/data-view'
// import Sortable from "sortablejs";
//流程图
import SuperFlow from 'vue-super-flow'
import 'vue-super-flow/lib/index.css'

/***********全局过滤器 ***********************************/
import * as customFilter from './utils/customFilter'
Object.keys(customFilter).forEach((key) => {
  Vue.filter(key, customFilter[key])
})

//全局指令注册
import './utils/directive'

Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value),
})
// Vue.use(Sortable);
Vue.use(VXETable, {
  // 对组件内置的提示语进行国际化翻译
  i18n: (key, args) => i18n.t(key, args),
  // 可选，对参数中的列头、校验提示..等进行自动翻译（只对支持国际化的有效）
  translate(key, args) {
    if (key) {
      return i18n.t(key, args)
    }
    return key
  },
})
Vue.use(DataV)
Vue.use(SuperFlow)
Vue.use(formCreate)
Vue.use(FcDesigner)
// set ElementUI lang to EN
Vue.use(ElementUI, { locale })
// Vue.use(VXETable)
Vue.use(Directives)
Vue.component('vue-ueditor-wrap', VueUeditorWrap)
Vue.component('UploadIndex', UploadIndex)
Vue.component('iconFrom', iconFrom)
Vue.component('ueditorFrom', ueditorFrom)
Vue.component('uploadFile', UploadFile)
Vue.component('timeSelect', TimeSelect)
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)
Vue.prototype.$utils = XEUtils
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  i18n,
  store,
  render: (h) => h(App),
})
